package com.charzhan.two;

import com.charzhan.utiles.rabbitmqutil;
import com.rabbitmq.client.Channel;

import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class prudece {
    public static final String QUEUE_NAME="hello";

    public static void main(String[] args) throws Exception {

        Channel channel = rabbitmqutil.getChannel();
        channel.queueDeclare(QUEUE_NAME,false,false,false,null);
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String next = scanner.next();
            channel.basicPublish("",QUEUE_NAME,null,next.getBytes(StandardCharsets.UTF_8));
        }
    }
}
